#include <bits/stdc++.h>
#define endl '\n'
#define PII pair<int, int>
#define int long long
using namespace std;
const int N = 1e6 + 100;
int n, a[N];
int how_many[N], sum[N];
void read (int &x){
	int res = 0;
	char c;
	while (c = getchar()){
		if (c == ' ' || c == '\n'){
            x = res;
			return ;
		}
		res = res * 10 + (int)(c - '0');
	}
}
void write (int x){
	cout << x;
	return ;
}
signed main(){
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	freopen ("duel.in", "r", stdin);
	freopen ("duel.out", "w", stdout);
	read(n);
	for (int i = 1; i <= n; i++){
		read(a[i]);
	}
	sort (a + 1, a + 1 + n);
	for (int i = 1; i <= n; i++){
		how_many[a[i]]++;
	}
	for (int i = 1; i <= a[n] + 10; i++){
		sum[i] += how_many[i];
	}
	int ans = n, last = 0, num, cnt;
	for (int i = 1; i <= n; i++){

		if (last != a[i]){
			num = 0, cnt = 0;
			for (int j = i + 1; j <= n; j++){
				if (a[j] != a[j - 1] && how_many[a[j]] != 0){
					num = how_many[a[j]];
					cnt = j;
					break;
				}
			}
			if (cnt == 0){
                cnt = 0x3f3f3f3f;
			}
			last = a[i];
		}
		if (num > 0){
			num--;
			ans--;
		}else{
			for (int j = cnt; j <= n; j++){
				if (how_many[a[j]] > 0 && a[j] != a[cnt]){
                    //cout << j << endl;
					how_many[a[j]]--;
					ans--;
					break;
				}
			}
		}
	}
	cout << ans;
	return 0;
}